
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Dashboard Template for Bootstrap</title>

    <!-- Bootstrap core CSS -->
    <link href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="/static/css/dashboard.css" rel="stylesheet">
    <script src="/static/js/adddate.js"></script>

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Monitor System</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
            <li><a href="#">Dashboard</a></li>
            <li><a href="#">Settings</a></li>
            <li><a href="#">Profile</a></li>
            <li><a href="#">Help</a></li>
          </ul>
          <form class="navbar-form navbar-right">
            <input type="text" class="form-control" placeholder="Search...">
          </form>
        </div>
      </div>
    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
          <ul class="nav nav-sidebar">
            {% for h in hosts %}
                {% if h == selected_host %}
                <li class="active"><a href="/?host={{ h }}&item={{ selected_item }}">{{ h }}</a></li>
                {% else %}
                <li><a href="/?host={{ h }}&item={{ selected_item }}">{{ h }}</a></li>
                {% endif %}
            {% endfor %}
          </ul>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
          <h1 class="page-header">REBOOT Monitor</h1>
          <div class="row">
            <div class="dropdown col-sm-2">
              <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                {{ selected_item }}
                <span class="caret"></span>
              </button>
              <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                {% for item in items %}
                <li><a href="/?host={{ selected_host }}&item={{ item }}">{{ item }}</a></li>
                {% endfor %}
              </ul>
            </div>
            <div class="input-group col-sm-offset-2 col-sm-10">
              <span class="input-group-addon" id="sizing-addon1">开始时间:</span> 
              <span><input type="text" placeholder="开始" class="form-control" value="" id="from" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss')"></span>
              <span class="input-group-addon" id="sizing-addon1">结束时间:</span> 
              <span><input type="text" placeholder="结束" class="form-control" value="" id="to" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss')"></span>
            </div>
            <h1 class="page-header"> </h1>
            <div class="input-group-lg col-sm-offset-2 col-sm-10">
              <button id="checkid" type="button" class="btn btn-default">点击这里画图</button>
            </div>
          </div>
          <h2 class="sub-header">{{ selected_item  }}</h2>
          <div id="container" style="min-width:700px;height:400px"></div> 
          <div class="table-responsive" id="mon_chart">
          </div>
        </div>
      </div>
    </div>

    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script> 
    <script type="text/javascript" src="/static/highstock.js"></script> 
    <script type="text/javascript" src="/static/js/exporting.js"></script> 
    <script>
    //url = document.getElementById('').value()
    Highcharts.setOptions({
            global: {
                useUTC: false
            }
        });
 
    $('#checkid').on('click',function () {
        from = '&from=' + $('#from').val();
        to = '&to=' + $('#to').val();
        url = 'getdata'+ window.location.search + from + to + '&callback=?'

        $.getJSON(url, function (data) {
            // Create the chart
            $('#container').highcharts('StockChart', {
                rangeSelector : {
                    selected : 1
                },

                title : {
                    text : '{{ host }}--{{ item }}'
                },

                series : [{
                    name : '{{ host }}',
                    data : data,
                    tooltip: {
                        valueDecimals: 1
                    }
                }]
            });
        });
    });


    </script>
  </body>
</html>

